home *** CD-ROM | disk | FTP | other *** search
/ PD Collection CD 1 / PD Collection CD 1.iso / programer2 / sdls / DLLLib_h_ctype < prev    next >
Encoding:
Text File  |  1994-03-05  |  3.2 KB  |  113 lines

  1. #pragma force_top_level
  2. #pragma include_only_once
  3.  
  4. /* ctype.h: ANSI 'C' (X3J11 Oct 88) library header, section 4.3 */
  5. /* Copyright (C) Codemist Ltd. */
  6. /* Copyright (C) Acorn Computers Ltd. 1991, 1992 */
  7. /* version 2.00 */
  8.  
  9. /*
  10.  * ctype.h declares several functions useful for testing and mapping
  11.  * characters. In all cases the argument is an int, the value of which shall
  12.  * be representable as an unsigned char or shall equal the value of the
  13.  * macro EOF. If the argument has any other value, the behaviour is undefined.
  14.  */
  15.  
  16. #ifndef __ctype_h
  17. #define __ctype_h
  18.  
  19. /* N.B. - keep in step with <ctype.c> */
  20.  
  21. #define __S 1            /* whitespace           */
  22. #define __P 2            /* punctuation          */
  23. #define __B 4            /* blank                */
  24. #define __L 8            /* lower case letter    */
  25. #define __U 16           /* upper case letter    */
  26. #define __N 32           /* (decimal) digit      */
  27. #define __C 64           /* control chars        */
  28. #define __X 128          /* A-F and a-f          */
  29.  
  30. #ifdef __cplusplus
  31.   extern "C" {
  32. #endif
  33.  
  34. #ifdef SYSTEM_STATICS
  35.   extern unsigned *__ctype;
  36. #elif defined(_DLL)
  37.   extern unsigned char *_dll_ctype(void);
  38.   #define __ctype (_dll_ctype())
  39. #else
  40.   extern unsigned char __ctype[];
  41. #endif
  42.  
  43. #ifdef __cplusplus
  44.   }
  45. #endif
  46.  
  47. #define isalnum(c) (__ctype[c] & (__U+__L+__N))
  48.     /* non-0 iff c is alphabetic or numeric */
  49.  
  50. #define isalpha(c) (__ctype[c] & (__U+__L))
  51.     /* non-0 iff c is alphabetic */
  52.  
  53. #define iscntrl(c) (__ctype[c] & __C)
  54.     /* non-0 iff c is a control character - in the ASCII locale */
  55.     /*       this means (c < ' ') || (c > '~')                  */
  56.  
  57. #define isdigit(c) (__ctype[c] & __N)
  58.     /* non-0 iff c is a decimal digit */
  59.  
  60. #define isgraph(c) (__ctype[c] & (__L+__U+__N+__P))
  61.     /* non-0 iff c is any printing character other than ' ' */
  62.  
  63. #define islower(c) (__ctype[c] & __L)
  64.     /* non-0 iff c is a lower-case letter */
  65.  
  66. #define isprint(c) (__ctype[c] & (__L+__U+__N+__P+__B))
  67.     /* non-0 iff c is a printing character - in the ASCII locale */
  68.     /*       this means 0x20 (space) -> 0x7E (tilde) */
  69.  
  70. #define ispunct(c) (__ctype[c] & __P)
  71.     /* non-0 iff c is a non-space, non-alpha-numeric, printing character */
  72.  
  73. #define isspace(c) (__ctype[c] & __S)
  74.     /* non-0 iff c is a white-space char: ' ', '\f', '\n', '\r', '\t', '\v'. */
  75.  
  76. #define isupper(c) (__ctype[c] & __U)
  77.     /* non-0 iff c is an upper-case letter */
  78.  
  79. #define isxdigit(c) (__ctype[c] & (__N+__X))
  80.     /* non-0 iff c is a digit, in 'a'..'f', or in 'A'..'F' */
  81.  
  82. #ifndef __cplusplus
  83. extern int (isalnum)(int c);
  84. extern int (isalpha)(int c);
  85. extern int (iscntrl)(int c);
  86. extern int (isdigit)(int c);
  87. extern int (isgraph)(int c);
  88. extern int (islower)(int c);
  89. extern int (isprint)(int c);
  90. extern int (ispunct)(int c);
  91. extern int (isspace)(int c);
  92. extern int (isupper)(int c);
  93. extern int (isxdigit)(int c);
  94. #endif
  95.  
  96. #ifdef __cplusplus
  97. extern "C" {
  98. #endif
  99. extern int tolower(int c);
  100.     /* if c is an upper-case letter then return the corresponding */
  101.     /* lower-case letter, otherwise return c.                     */
  102.  
  103. extern int toupper(int c);
  104.     /* if c is an lower-case letter then return the corresponding */
  105.     /* upper-case letter, otherwise return c.                     */
  106. #ifdef __cplusplus
  107. }
  108. #endif
  109.  
  110. #endif
  111.  
  112. /* end of ctype.h */
  113.